package cn.wolfcode.wolf2w.controller;


import cn.wolfcode.wolf2w.domain.Spot;
import cn.wolfcode.wolf2w.domain.SpotContent;
import cn.wolfcode.wolf2w.service.ISpotContentService;
import cn.wolfcode.wolf2w.service.ISpotService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.spring.web.json.Json;

import java.util.List;

@RestController
@RequestMapping("spotContents")
public class SpotContentController {

    @Autowired
    private ISpotContentService SpotContentService;
    @Autowired
    private ISpotService spotService;

    @GetMapping("queryByContentId")
    @ResponseBody
    public Object queryByContentId(String contentId){

        Spot spot = spotService.get(contentId);
        System.out.println(spot.getContentId());
        SpotContent spotContent = SpotContentService.get(spot.getContentId());
        System.out.println(spotContent);

        return JsonResult.success(spotContent);
    }

}
